<?php
ob_start();
include "../librari/koneksi.php";

$user=$_POST['user']; 
$pass=$_POST['pass'];


$user = stripslashes($user);
$pass = stripslashes($pass);
$user = mysql_real_escape_string($user);
$pass = mysql_real_escape_string($pass);

$sql="SELECT * FROM hrd WHERE nmHRD='$user' and passwdHRD='$pass'";
$result=mysql_query($sql);


$count=mysql_num_rows($result);


if($count==1){

session_register("user");
session_register("pass"); 
 echo "<script language='JavaScript'>
 alert('Anda Sukses Login. Klik OK!');
 document.location='home_hrd.php';

 </script>";

}
else {
echo "<script language='JavaScript'>
alert('Login Gagal! Username & password tidak benar. Silahkan mengulangi kembali. Klik OK!');
document.location='pagelogin.php';

 </script>";
}

ob_end_flush();
?>